package com.cqjtu.eecs.service.impl;

import com.cqjtu.eecs.entity.TrainingGoalTemplate;
import com.cqjtu.eecs.entity.vo.TrainingGoalTemplateVO;
import com.cqjtu.eecs.entity.vo.TrainingGoalVO;
import com.cqjtu.eecs.mapper.TrainingGoalBriefEntityMapper;
import com.cqjtu.eecs.mapper.TrainingGoalTemplateMapper;
import com.cqjtu.eecs.service.ITrainingGoalTemplateService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author   
 * @since 2022-02-28
 */
@Service
public class TrainingGoalTemplateServiceImpl extends ServiceImpl<TrainingGoalTemplateMapper, TrainingGoalTemplate> implements ITrainingGoalTemplateService {

    @Autowired
    private TrainingGoalTemplateMapper trainingGoalTemplateMapper;

    @Autowired
    private TrainingGoalBriefEntityMapper trainingGoalBriefEntityMapper;


    @Override
    public TrainingGoalVO getTrainingGoalVO(String majorCode, String versionCode) {
        try {
            TrainingGoalVO trainingGoalVO = new TrainingGoalVO();
            String trainingGoalBrief = trainingGoalBriefEntityMapper.getTrainingGoalBrief(majorCode, versionCode);
            trainingGoalVO.setTrainingGoalBrief(trainingGoalBrief);
            List<TrainingGoalTemplateVO> trainingGoalTemplateVOList = trainingGoalTemplateMapper.getTrainingGoal(majorCode, versionCode);
            trainingGoalVO.setTrainingGoalTemplateVO(trainingGoalTemplateVOList);
            return trainingGoalVO;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
